<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="db.DbClass" %>
<%@ page import="java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <script src='http://codepen.io/assets/libs/fullpage/jquery.js'></script>
<script src="js/index.js"></script>
<script src="/gg_bd_ad_720x90.js" type="text/javascript"></script>
<script src="/follow.js" type="text/javascript"></script>
<head>
<base href="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/" %>"/>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
 <meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- Iconos -->
	<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

    <link rel="stylesheet" href="css/style.css" media="screen" type="text/css" />
    <style type="text/css">
    body,td,th {
	font-family: "Open Sans", Arial, Helvetica, Sans-serif, Verdana, Tahoma;
	color: #5A7EB4;
}
    </style>
  </head>
  <body>
  <div id="index" ></div>
  <div class="b1"><strong>留言查看</strong></div>
    <%
      String name,email,subject,memo;
      
      // 执行sql语句，查询所有的留言信息
      Connection conn=new DbClass().getConn();
      Statement smt=conn.createStatement();
      ResultSet rs;
      String sql;
      sql="select * from message";
      // 执行sql语句
      rs=smt.executeQuery(sql);
       
      // 表头
      out.print("<center>"); 
      out.print("<table border=1>");
      out.print("<tr>");
      /* out.print("<td bgcolor=yellow>序列</td>"); */
      out.print("<td bgcolor=yellow>姓名</td>");
      out.print("<td bgcolor=yellow>E-Mail</td>");
      out.print("<td bgcolor=yellow>主题</td>");
      out.print("<td bgcolor=yellow>内容</td>");
      out.print("<td bgcolor=yellow>回复</td>");
      out.print("<td bgcolor=yellow>查看所有回复</td>");
      
      // 表内容
      while(rs.next()) 
		{ 
    	     
			name=rs.getString(2); 
			email=rs.getString(3); 
			subject=rs.getString(4);  
			memo=rs.getString(5); 
			//out.print("<center>"); 
			//out.print("<table border=1>"); 
			out.print("<tr>");
			
			out.print("<td>"+name+"</td>"); 
			out.print("<td>"+email+"</td>"); 
			out.print("<td>"+subject+"</td>"); 
			out.print("<td>"+memo+"</td>");
			out.print("<td><a href='reply.jsp?subject="+subject+"'>回复</a></td>");
			out.print("<td><a href='showallreply.jsp?subject="+subject+"'>查看回复</a></td>"); 
			out.print("</tr>");
			//out.print("</table><p>"); 
		} 
		out.print("</table><p>"); 
		out.print("<a href='index.jsp'>返回留言页面</a>");
 %>
  </body>
</html>
